<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:fn="http://java.sun.com/jsp/jstl/functions" 
xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
    <jsp:directive.page language="java"
        contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" />
    <table class="timer-entries editable-rows" id="entries">
    	<thead>
	  <tr>
	  	<th>Project</th>
	  	<th>Category</th>
	    <th>Description</th>
	  	<th>Time Spent</th>
	  	<th>Control</th>
	  </tr>
	  </thead>
	  
	  <tbody>

<c:choose><c:when test="${fn:length(todays) gt 0}">
<c:forEach items="${todays}" var="entry">
<c:set var="style"><c:if test="${entry.running}">running</c:if></c:set>
 <tr class="${style}">
 	<td style="display: none;">
		<input type="hidden" name="curProjectCategoryId" value="${entry.categoryId}"/>
 		<input type="hidden" name="entry.id" value="${entry.id}"/>
 		<input type="hidden" name="entry.seconds" value="${entry.seconds}"/>
 		<input type="hidden" name="edited" value="false"/>
 		<input type="hidden" name="running" value="${entry.running}" />
 	  <c:if test="${entry.running}">
 		<input type="hidden" name="timerStarted" value="${entry.timerStarted}"/>
 	  </c:if>
 	</td>
 	<td>
 		<span class="label"><c:forEach items="${projects}" var="project">
 			<c:if test="${project.id eq entry.projectId}">${project.name}</c:if>
 		</c:forEach></span>
 		<span class="input hidden">
 			<select name="entry.projectId">
 				<c:forEach items="${projects}" var="project">
 					<jsp:text><![CDATA[<option value="${project.id}"]]></jsp:text><c:if test="${entry.projectId eq project.id}">selected="selected"</c:if><jsp:text><![CDATA[>${project.name}</option>]]></jsp:text>
 				</c:forEach>
 			</select>
 		</span>
 	</td>
 	<td>
 		<span class="label"><c:forEach items="${categories}" var="category">
 			<c:if test="${category.id eq entry.categoryId}">${category.name}</c:if>
 		</c:forEach></span>
 		<span class="input hidden">
 			<select name="entry.categoryId"></select>
 		</span>
 	</td>
   <td>
	   	<span class="label">${entry.description}</span>
	   	<span class="input hidden"><input type="text" name="entry.description" value="${entry.description}"/></span>
   </td>
   <td>
		<span class="label">${entry.count}</span>
   		<span class="input hidden"><input type="text" name="entry.count" value="${entry.count}"/></span>
   </td>
   <td>
    	<a href="#update" style="display: none;">Update</a>
		<c:if test="${not entry.running}">
	   	<a href="#start">
	   		Start Timer
	   	</a>
   	</c:if>
   	<c:if test="${entry.running}">
   		<a href="#stop">
   			Stop Timer
    	</a>
   	</c:if>
	    </td>
	  </tr>
</c:forEach>
</c:when>
<c:otherwise>
	<tr>
		<td colspan="5"> - no entries - </td>
	</tr>
</c:otherwise>
</c:choose>
</tbody>
	</table>
</jsp:root>